package com.doit.demo06;

public class test {
    private static final String [] s = {"段段","红红","光光"};
    public static void main(String[] args) {

        try {
            tianjia("段红光");
        }catch (Exception e){
            System.out.println(e.getMessage());
        }

    }
    public static void tianjia(String s1)
    {
            for(String ss:s)
            {
                if(ss==s1)
                    throw new HaveItException("已经有这个名字了");
            }
            System.out.println("注册成功");
    }
}
